var number = 0;
var money = 0;
var playTypes = null;//获取投注方式
var playType = null;//下注方式
var lotteryArr = [];//购彩内容
var arr1 = [],arr2 = [];//存储数组1 //存储数组2
var content1 ,content2 ; // 对应content
var content = '';//content
var clickCount = 0; //记录点击次数
var tou = '',tou2 = '',tou3 = '',tou4 = '';//拖头1 //拖头2 //拖头3 //拖头4
var earry = [{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]}]; //过关下注存储数组
var lmaNav = 'eqz',lmaMnv = 'fs';  //连码 默认二全中 // 默认复式
var sxlNav = 'exl',sxlMav = 'fs';  //生肖连 默认二全中 // 默认复式
var wslNav = 'ewl',wslMav = 'fs';  //尾数连 默认二尾中 // 默认复式
var bzNav = 'wbz',bzMav = 'fs';  //不中 默认五不中 // 默认复式 
var zyNav = 'wbz',zyMav = 'fs' ;  //多选中一  默认五选中一 //默认复式
var tpzNav = 'ylrz',tpzMav = 'fs';  //特平中  默认一粒任中 //默认复式

// 玩法选择
$('#elem_jscq div').click(function(){
  $(this).siblings().removeClass('hover');
  $(this).addClass('hover');
  var index = $(this).index();
  $('.common .list').eq(index).show().siblings().hide();
  reset()
})

// 正特码nav切换
$('.ztma-nav span').click(function(){
  $(this).addClass('hover').siblings().removeClass('hover');
  var index = $(this).index();
  $('.ztma-number span').data('type','ztm_zt'+(index+1));
  $('.ztm-dx').data('type','ztm_zt'+(index+1)+'_dx');
  $('.ztm-ds').data('type','ztm_zt'+(index+1)+'_ds');
  $('.ztm-hds').data('type','ztm_zt'+(index+1)+'_hds');
  $('.ztm-wdx').data('type','ztm_zt'+(index+1)+'_wdx');
  $('.ztm-hb').data('type','ztm_zt'+(index+1)+'_bs');
  $('.ztm-lanb').data('type','ztm_zt'+(index+1)+'_bs');
  $('.ztm-lb').data('type','ztm_zt'+(index+1)+'_bs');

  reset()
})

// 连码一级选择
$('.lma-nav span').click(function(){
  var index = $(this).index();
  
  $(this).addClass('hover').siblings().removeClass('hover');
  var odds = $('.lma-content').data('odds');
  $('.lma-mnav span').eq(0).addClass('hover').siblings().removeClass('hover');//二级选择重新选择到第一个
  $('.lma-content .lma-list').eq(0).show().siblings().hide();//显示内容对应

  reset()
  if( index == 0 || index == 1 || index ==2){
    $('.lma-mnav span').show();
  }else if(index == 3 || index == 4){
    $('.lma-mnav span').eq(2).hide();
    $('.lma-mnav span').eq(3).hide();
    $('.lma-mnav span').eq(4).hide();
    $('.lma-mnav span').eq(5).hide();
  }
  switch(index){
    case 0:
      $('.lma-number span').data('type','lm_eqz');
      $('.sxdp span').data('type','lm_eqz_sxdp');
      $('.wsdp span').data('type','lm_eqz_wsdp');
      $('.swdp span').data('type','lm_eqz_swdp');
      lmaNav = 'eqz';
      $('.lma-list .bifa-m span i').text(odds.eqz);
      break;
    case 1:
      $('.lma-number span').data('type','lm_ezt');
      $('.sxdp span').data('type','lm_ezt_sxdp');
      $('.wsdp span').data('type','lm_ezt_wsdp');
      $('.swdp span').data('type','lm_ezt_swdp');
      $('.lma-list .bifa-m span i').text(odds.ezt+'/'+odds.ez);
      lmaNav = 'ezt';
      break;
    case 2:
      $('.lma-number span').data('type','lm_tc');
      $('.sxdp span').data('type','lm_tc_sxdp');
      $('.wsdp span').data('type','lm_tc_wsdp');
      $('.swdp span').data('type','lm_tc_swdp');
      $('.lma-list .bifa-m span i').text(odds.tc);
      lmaNav = 'tc';
      break;
    case 3:
      $('.lma-number span').data('type','lm_sze');
      $('.sxdp span').data('type','lm_sze_sxdp');
      $('.wsdp span').data('type','lm_sze_wsdp');
      $('.swdp span').data('type','lm_sze_swdp');
      $('.lma-list .bifa-m span i').text(odds.szes+'/'+odds.szee);
      lmaNav = 'sze';
      break;
    case 4:
      $('.lma-number span').data('type','lm_sqz');
      $('.sxdp span').data('type','lm_sqz_sxdp');
      $('.wsdp span').data('type','lm_sqz_wsdp');
      $('.swdp span').data('type','lm_sqz_swdp');
      $('.lma-list .bifa-m span i').text(odds.sqz);
      lmaNav = 'sqz';
      break;
  }
  
})
// 连码二级选择
$('.lma-mnav span').click(function(){
  var index = $(this).index();
  $(this).addClass('hover').siblings().removeClass('hover');
  $('.lma-content .lma-list').eq(index).show().siblings().hide();
  reset();
  switch(index){
    case 0:
      lmaMnv = 'fs';
      break;
    case 1:
      lmaMnv = 'tt';
      break;
    case 2:
      lmaMnv = 'sxdp';
      break;
    case 3:
      lmaMnv = 'wsdp';
      break;
    case 4:
      lmaMnv = 'swdp';
      break;
    case 5:
      lmaMnv = 'rydp';
      break;
  }
})

// 六肖nav
$('.liux-nav span').click(function(){
  reset();
  var index  = $(this).index();
  var odds = $('.liux').data('odds')
  $(this).addClass('hover').siblings().removeClass('hover');
  switch(index){
    case 0:
      $('.lxiao span.lx-tag').data('type','lx_ex');
      $('.lxiao i').text(odds.ex)
      break;
    case 1:
      $('.lxiao span.lx-tag').data('type','lx_sanx');
      $('.lxiao i').text(odds.sanx)
      break;
    case 2:
      $('.lxiao span.lx-tag').data('type','lx_sx');
      $('.lxiao i').text(odds.six)
      break;
    case 3:
      $('.lxiao span.lx-tag').data('type','lx_wux');
      $('.lxiao i').text(odds.wx)
      break;
    case 4:
      $('.lxiao span.lx-tag').data('type','lx_lx');
      $('.lxiao i').text(odds.lx)
      break;
  }
})

// 一肖尾数nav
$('.yix-nav span').click(function(){
  reset();
  var index  = $(this).index();
  var odds = $('.yix').data('odds');
  $(this).addClass('hover').siblings().removeClass('hover');
  switch(index){
    case 0:
      $('.yxiao span.yx-tag').data('type','yxws_yx');
      $('.yxiao i').text(odds.yxother)
      $('.yxiao i.gou').text(odds.yxgou)
      break;
    case 1:
      $('.yxiao span.yx-tag').data('type','yxws_yxbz');
      $('.yxiao i').text(odds.yxbzother)
      $('.yxiao i.gou').text(odds.yxbzgou)
      break;
    case 2:
      $('.wsbz-body .wsqz span').data('type','yxws_ws');
      $('.wsqz span i').text(odds.wsydj)
      $('.wsqz span.ling i').text(odds.ws0)
      break;
    case 3:
      $('.wsbz-body .wsqz span').data('type','yxws_wsbz');
      $('.wsqz span i').text(odds.wsbzydj)
      $('.wsqz span.ling i').text(odds.wsbz0)
      break;
  }
  if(index == 0 || index == 1){
    $('.yxbz-body').show();
    $('.wsbz-body').hide();
  }else if(index == 2 || index == 3){
    $('.yxbz-body').hide();
    $('.wsbz-body').show();
  }
})

// 生肖连nav
$('.sxl-nav span').click(function(){
  reset();
  var index  = $(this).index();
  var odds = $('.sxiaol').data('odds');
  $(this).addClass('hover').siblings().removeClass('hover');
  $('.sxl-mnav span').eq(0).addClass('hover').siblings().removeClass('hover')
  sxlMav = 'fs';
  switch(index){
    case 0:
      $('.sxiao span.sxl-tag').data('type','sxl_exl');
      $('.sxiao i').text(odds.exlzother);
      $('.sxiao i.gou').text(odds.exlzgou);
      sxlNav = 'exl'
      break;
    case 1:
      $('.sxiao span.sxl-tag').data('type','sxl_sanxl');
      $('.sxiao i').text(odds.sxlzother);
      $('.sxiao i.gou').text(odds.sxlzgou);
      sxlNav = 'sxl'
      break;
    case 2:
      $('.sxiao span.sxl-tag').data('type','sxl_sxl');
      $('.sxiao i').text(odds.sixlzother);
      $('.sxiao i.gou').text(odds.sixlzgou);
      sxlNav = 'sixl'
      break;
    case 3:
      $('.sxiao span.sxl-tag').data('type','sxl_wxl');
      $('.sxiao i').text(odds.wxlzother);
      $('.sxiao i.gou').text(odds.wxlzgou);
      sxlNav = 'wxl'
      break;
    case 4:
      $('.sxiao span.sxl-tag').data('type','sxl_exlbz');
      $('.sxiao i').text(odds.exlbz);
      sxlNav = 'exlbz'
      break;
    case 5:
      $('.sxiao span.sxl-tag').data('type','sxl_sanxlbz');
      $('.sxiao i').text(odds.sxlbz);
      sxlNav = 'sxlbz'
      break;
    case 6:
      $('.sxiao span.sxl-tag').data('type','sxl_sxlbz');
      $('.sxiao i').text(odds.sixlbz);
      sxlNav = 'sixlbz'
      break;
    case 7:
      $('.sxiao span.sxl-tag').data('type','sxl_wxlbz');
      $('.sxiao i').text(odds.wxlbz);
      sxlNav = 'wxlbz'
      break;
  }
})

// 生肖连二级选择
$('.sxl-mnav span').click(function(){
  $(this).addClass('hover').siblings().removeClass('hover');
  var index  = $(this).index();
  index == 0 ? sxlMav = 'fs' : sxlMav = 'tt';
  reset();
});


// 尾数连nav
$('.wsl-nav span').click(function(){
  reset()
  var index  = $(this).index();
  var odds = $('.wshul').data('odds');
  $(this).addClass('hover').siblings().removeClass('hover');
  $('.wsl-mnav span').eq(0).addClass('hover').siblings().removeClass('hover')
  wslMav = 'fs';
  switch(index){
    case 0:
      $('.wslian span').data('type','wsl_ewl');
      $('.wslian span i').text(odds.ewlz);
      wslNav = 'ewl';
      break;
    case 1:
      $('.wslian span').data('type','wsl_sanwl');
      $('.wslian span i').text(odds.swlz);
      wslNav = 'swl';
      break;
    case 2:
      $('.wslian span').data('type','wsl_swl');
      $('.wslian span i').text(odds.siwlz);
      wslNav = 'siwl';
      break;
    case 3:
      $('.wslian span').data('type','wsl_ewlbz');
      $('.wslian span i').text(odds.ewlbzydj);
      $('.wslian span.ling i').text(odds.ewlbzn);
      wslNav = 'ewlbz';
      break;
    case 4:
      $('.wslian span').data('type','wsl_sanwlbz');
      $('.wslian span i').text(odds.swlbzydj);
      $('.wslian span.ling i').text(odds.swlbzn);
      wslNav = 'swlbz';
      break;
    case 5:
      $('.wslian span').data('type','wsl_swlbz');
      $('.wslian span i').text(odds.siwlbzydj);
      $('.wslian span.ling i').text(odds.siwlbzn);
      wslNav = 'siwlbz';
      break;
  }
})

// 尾数连二级选择
$('.wsl-mnav span').click(function(){
  $(this).addClass('hover').siblings().removeClass('hover');
  var index  = $(this).index();
  index == 0 ? wslMav = 'fs' : wslMav = 'tt';
  reset();
});

// 不中nav
$('.bz-nav span').click(function(){
  reset();
  var index  = $(this).index();
  var odds = $('.buzhong').data('odds');
  $(this).addClass('hover').siblings().removeClass('hover');
  $('.bz-mnav span').eq(0).addClass('hover').siblings().removeClass('hover')
  bzMav = 'fs';
  switch(index){
    case 0:
      $('.buz span').data('type','bz_wbz');
      $('.buz span i').text(odds.wbz);
      bzNav = 'wbz';
      break;
    case 1:
      $('.buz span').data('type','bz_lbz');
      $('.buz span i').text(odds.lbz);
      bzNav = 'lbz';
      break;
    case 2:
      $('.buz span').data('type','bz_qbz');
      $('.buz span i').text(odds.qbz)
      bzNav = 'qbz';
      break;
    case 3:
      $('.buz span').data('type','bz_bbz');
      $('.buz span i').text(odds.bbz);
      bzNav = 'bbz';
      break;
    case 4:
      $('.buz span').data('type','bz_jbz');
      $('.buz span i').text(odds.jbz);
      bzNav = 'jbz';
      break;
    case 5:
      $('.buz span').data('type','bz_sbz');
      $('.buz span i').text(odds.sbz);
      bzNav = 'sbz';
      break;
  }
})

// 不中二级选择
$('.bz-mnav span').click(function(){
  $(this).addClass('hover').siblings().removeClass('hover');
  var index = $(this).index();
  index == 0 ? bzMav = 'fs' : bzMav = 'tt';
  reset();
});

// 多选中一nav
$('.dx-nav span').click(function(){
  reset();
  var index  = $(this).index();
  var odds = $('.duoxuan').data('odds');
  $(this).addClass('hover').siblings().removeClass('hover');
  $('.dx-mnav span').eq(0).addClass('hover').siblings().removeClass('hover')
  zyMav = 'fs';
  switch(index){
    case 0:
      $('.duox span').data('type','dxy_wxzy');
      $('.duox span i').text(odds.wxzy);
      zyNav = 'wbz';
      break;
    case 1:
      $('.duox span').data('type','dxy_lxzy');
      $('.duox span i').text(odds.lxzy);
      zyNav = 'lbz';
      break;
    case 2:
      $('.duox span').data('type','dxy_qxzy');
      $('.duox span i').text(odds.qxzy);
      zyNav = 'qbz';
      break;
    case 3:
      $('.duox span').data('type','dxy_bxzy');
      $('.duox span i').text(odds.bxzy);
      zyNav = 'bbz';
      break;
    case 4:
      $('.duox span').data('type','dxy_jxzy');
      $('.duox span i').text(odds.jxzy);
      zyNav = 'jbz';
      break; 
    case 5:
      $('.duox span').data('type','dxy_sxzy');
      $('.duox span i').text(odds.sxzy);
      zyNav = 'sbz';
      break;
  }
})

// 多选中一二级选择
$('.dx-mnav span').click(function(){
  $(this).addClass('hover').siblings().removeClass('hover');
  var index = $(this).index();
  index == 0 ? zyMav = 'fs' : zyMav = 'tt';
  reset();
});

// 特平中nav
$('.tp-nav span').click(function(){
  reset();
  var index  = $(this).index();
  var trueOff = true;
  var odds = $('.teping').data('odds');
  $(this).addClass('hover').siblings().removeClass('hover');
  $('.tp-mnav span').eq(0).addClass('hover').siblings().removeClass('hover')
  tpzMav = 'fs';
  switch(index){
    case 0:
      $('.tep span').data('type','tpz_ylrz');
      $('.tep span i').text(odds.ylrz);
      trueOff = false;
      tpzNav = 'ylrz';
      break;
    case 1:
      $('.tep span').data('type','tpz_elrz');
      $('.tep span i').text(odds.elrz);
      tpzNav = 'elrz';
      break;
    case 2:
      $('.tep span').data('type','tpz_sanlrz');
      $('.tep span i').text(odds.slrz);
      tpzNav = 'slrz';
      break;
    case 3:
      $('.tep span').data('type','tpz_slrz');
      $('.tep span i').text(odds.silrz);
      tpzNav = 'silrz';
      break;
    case 4:
      $('.tep span').data('type','tpz_wlrz');
      $('.tep span i').text(odds.wlrz);
      tpzNav = 'wlrz';
      break;
  }
  if(trueOff){
    $('.tp-mnav').show();
  }else{
    $('.tp-mnav').hide();
  }
})

// 特平中二级选择
$('.tp-mnav span').click(function(){
  $(this).addClass('hover').siblings().removeClass('hover');
  var index = $(this).index();
  index == 0 ? tpzMav = 'fs' : tpzMav = 'tt';
  reset();
});


// 选择下注 
// 特码、正码、正特码下注
$('.tema span, .zma span , .ztma span').click(function(){
  $(this).toggleClass('hover-v');
  
  var lotterObj = {
    playType:$(this).data('type'),
    content:String($(this).data('content')),
    odds:$('i',this).text(),
    payPrice:2,
    times:1
  }
  
  if($(this).hasClass('hover-v')){
    lotteryArr.push(lotterObj);
    number++;
    money+=2;
  }else{
    lotteryArr.pop(lotterObj);
    number--;
    money-=2;
  }
  $('#zhu').text(number);
  $('#money').text(money);
  $('.content').data('content',lotteryArr) //记录下注信息
})

// 连码下注
$('.lma span').click(function(){
  lotteryArr = [];
  playTypes = $(this).data('type');//获取投注方式

  if(lmaNav == 'eqz' || lmaNav == 'ezt' || lmaNav == 'tc'){ //二全中、二中特、特串
    var content = $(this).data('content');

    if(lmaMnv == 'fs'){//复式
      $(this).toggleClass('hover-v');
      $(this).hasClass('hover-v')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          content = arr1[i] + ',' + arr1[j]
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:$('i',this).text(),
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
          $('.content').data('content',lotteryArr)
        }
      }
      
    }else if(lmaMnv == 'tt'){//拖头
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $(this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover-v');
        $(this).hasClass('hover-v')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' + arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }else if(lmaMnv == 'rydp'){//任意对碰

      opposite($(this));
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = 0,jL = arr2.length;j<jL;j++){
          var content = arr1[i] + ',' + arr2[j];
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:$('i',this).text(),
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
          $('.content').data('content',lotteryArr)
        }
      }
      
    }else if(lmaMnv == 'sxdp'){ //生肖对碰
      var that = $(this);
      sxNumber();
      if(that.parent().hasClass('aqu')){
        
        content1 = that.data('content') + '';
        
        if( content1 != content2){
          
          that.toggleClass('hover-v').siblings().removeClass('hover-v');
          
          that.hasClass('hover-v') ? arr1 = $(this).data('index') : arr1 = []
        }
        
        
      }else if(that.parent().hasClass('bqu')){
        
        content2 = that.data('content') + '';
        if( content2 !== content1){
          that.toggleClass('hover-v').siblings().removeClass('hover-v');
          
          that.hasClass('hover-v') ? arr2 = $(this).data('index') : arr2 = []
        }
   
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = 0,jL = arr2.length;j<jL;j++){
          var content = arr1[i] + ',' + arr2[j];
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:$('i',this).text(),
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
          $('.content').data('content',lotteryArr)
          
        }
      }
      
    }else if(lmaMnv == 'wsdp'){ //尾数对碰
      var that = $(this);
      if(that.parent().hasClass('aqu')){
        
        content1 = that.data('content') + '';
        
        if( content1 != content2){
          
          that.toggleClass('hover-v').siblings().removeClass('hover-v');
          
          that.hasClass('hover-v') ? arr1 = that.data('index').split(',') : arr1 = []
          
        }
        
        
      }else if(that.parent().hasClass('bqu')){
        
        content2 = that.data('content') + '';
        if( content2 !== content1){
          that.toggleClass('hover-v').siblings().removeClass('hover-v');
          
          that.hasClass('hover-v') ? arr2 = that.data('index').split(',') : arr2 = []
        }
   
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = 0,jL = arr2.length;j<jL;j++){
          var content = arr1[i] + ',' + arr2[j];
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:$('i',this).text(),
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
          $('.content').data('content',lotteryArr)
          
        }
      }
    }else if(lmaMnv == 'swdp'){//声尾对碰
      var that = $(this);
      sxNumber();
      if(that.parent().hasClass('aqu')){
                
        that.toggleClass('hover-v').siblings().removeClass('hover-v');
        
        that.hasClass('hover-v') ? arr1 = that.data('index') : arr1 = []
        
        
      }else if(that.parent().hasClass('bqu')){
        
        that.toggleClass('hover-v').siblings().removeClass('hover-v');
        
        that.hasClass('hover-v') ? arr2 = that.data('index').split(',') : arr2 = []
   
      }
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = 0,jL = arr2.length;j<jL;j++){
          var content = arr1[i] + ',' + arr2[j];
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:$('i',this).text(),
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
          $('.content').data('content',lotteryArr)
          
        }
      }
    }
    
  }else if(lmaNav == 'sze' || lmaNav == 'sqz'){//三中二
    var content = $(this).data('content');
    if(lmaMnv == 'fs'){//复式
      $(this).toggleClass('hover-v');
      $(this).hasClass('hover-v')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            content = arr1[i] + ',' + arr1[j] + ',' + arr1[k]
            var lotterObj = {
              playType:playTypes,
              content:content,
              odds:$('i',this).text(),
              payPrice:2,
              times:1
            }
            lotteryArr.push(lotterObj);
            $('.content').data('content',lotteryArr)
          }
          
        }
      }
      
    }else if(lmaMnv == 'tt'){//拖头
      if(clickCount == 0){
        $(this).toggleClass('hover-gray')
        clickCount++;
        tou = $(this).data('content');
        $(this).data('count','1');
        
      }else if(clickCount == 1){
        $(this).toggleClass('hover-gray')
        clickCount++;
        tou2 = $(this).data('content');
        $(this).data('count','1');
        
      }else{
        $(this).toggleClass('hover-v');
        $(this).hasClass('hover-v')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' + tou2 + ',' + arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  }

  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);

  function opposite(that){
    if(that.parent().hasClass('aqu')){
        
      var boole = false;
      for(var i = 0,iL = arr2.length;i<iL;i++){
        if(that.data('content') == arr2[i]){
          boole = true
        };
      }
      if( !boole ){
        
        that.toggleClass('hover-v');
        var content = that.data('content') + '';
        that.hasClass('hover-v') ? arr1.push(content) :arr1.pop(content)
      } 
     
    }else if(that.parent().hasClass('bqu')){
      
      var boole = false;
      for(var i = 0,iL = arr1.length;i<iL;i++){
        if(that.data('content') == arr1[i]){
          boole = true
        };
      }
      if( !boole ){          
        that.toggleClass('hover-v');
        var content = that.data('content') + ''
        that.hasClass('hover-v') ? arr2.push(content) :arr2.pop(content)
      }
 
    }
    
    
  }
})

// 过关下注
$('.gg span').click(function(){
  lotteryArr = [];
  $(this).toggleClass('hover-v');
  playTypes = $(this).data('type');//获取投注方式
  var content = $(this).data('content');
  if($(this).parent().hasClass('yi')){

    if($(this).hasClass('hover-v')){
      earry[0].arr.push(content)
      earry[0].odds.push($('i',this).text());
    }else{
      earry[0].arr.pop(content);
      earry[0].odds.pop($('i',this).text());
    }

  }else if($(this).parent().hasClass('er')){
    if($(this).hasClass('hover-v')){
      earry[1].arr.push(content)
      earry[1].odds.push($('i',this).text());
    }else{
      earry[1].arr.pop(content);
      earry[1].odds.pop($('i',this).text());
    }
  }else if($(this).parent().hasClass('san')){
    if($(this).hasClass('hover-v')){
      earry[2].arr.push(content)
      earry[2].odds.push($('i',this).text());
    }else{
      earry[2].arr.pop(content);
      earry[2].odds.pop($('i',this).text());
    }
  }else if($(this).parent().hasClass('si')){
    if($(this).hasClass('hover-v')){
      earry[3].arr.push(content)
      earry[3].odds.push($('i',this).text());
    }else{
      earry[3].arr.pop(content);
      earry[3].odds.pop($('i',this).text());
    }
  }else if($(this).parent().hasClass('wu')){
    if($(this).hasClass('hover-v')){
      earry[4].arr.push(content)
      earry[4].odds.push($('i',this).text());
    }else{
      earry[4].arr.pop(content);
      earry[4].odds.pop($('i',this).text());
    }
  }else if($(this).parent().hasClass('liu')){
    if($(this).hasClass('hover-v')){
      earry[5].arr.push(content)
      earry[5].odds.push($('i',this).text());
    }else{
      earry[5].arr.pop(content);
      earry[4].odds.pop($('i',this).text());
    }
  }
  

  function two(a,b){//任意两个组合
      for(var i = 0;i<earry[a].arr.length;i++){
        for(var k = 0;k<earry[b].arr.length;k++){
          content = earry[a].arr[i] + ',' + earry[b].arr[k];
          var odds = (earry[a].odds[i] * earry[b].odds[k]).toFixed(2)
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:odds,
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
        }
      }
  }

  function three(a,b,c){//任意三个组合
    for(var i = 0;i<earry[a].arr.length;i++){
      for(var k = 0;k<earry[b].arr.length;k++){
        for(var j = 0;j<earry[c].arr.length;j++){
          content = earry[a].arr[i] + ',' + earry[b].arr[k]+ ',' + earry[c].arr[j];
          var odds = (earry[a].odds[i] * earry[b].odds[k] * earry[c].odds[j]).toFixed(2)
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:odds,
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
        }
      }
    }
  }

  function four(a,b,c,d){//任意四个组合
    for(var i = 0;i<earry[a].arr.length;i++){
      for(var k = 0;k<earry[b].arr.length;k++){
        for(var j = 0;j<earry[c].arr.length;j++){
          for(var m = 0;m<earry[d].arr.length;m++){
            content = earry[a].arr[i] + ',' + earry[b].arr[k]+ ',' + earry[c].arr[j]+ ',' + earry[d].arr[m];
            var odds = (earry[a].odds[i] * earry[b].odds[k] * earry[c].odds[j]* earry[d].odds[m]).toFixed(2)
            var lotterObj = {
              playType:playTypes,
              content:content,
              odds:odds,
              payPrice:2,
              times:1
            }
            lotteryArr.push(lotterObj);
          }
          
        }
      }
    }
  }
  function five(a,b,c,d,e){//任意五个组合
    for(var i = 0;i<earry[a].arr.length;i++){
      for(var k = 0;k<earry[b].arr.length;k++){
        for(var j = 0;j<earry[c].arr.length;j++){
          for(var m = 0;m<earry[d].arr.length;m++){
            for(var n = 0;n<earry[e].arr.length;n++){
              content = earry[a].arr[i] + ',' + earry[b].arr[k]+ ',' + earry[c].arr[j]+ ',' + earry[d].arr[m]+ ',' + earry[e].arr[n];
              var odds = (earry[a].odds[i] * earry[b].odds[k] * earry[c].odds[j]* earry[d].odds[m]* earry[e].odds[n]).toFixed(2)
              var lotterObj = {
                playType:playTypes,
                content:content,
                odds:odds,
                payPrice:2,
                times:1
              }
              lotteryArr.push(lotterObj);
            }
            
          }
          
        }
      }
    }
  }
  function six(a,b,c,d,e,f){//任意六个组合
    for(var i = 0;i<earry[a].arr.length;i++){
      for(var k = 0;k<earry[b].arr.length;k++){
        for(var j = 0;j<earry[c].arr.length;j++){
          for(var m = 0;m<earry[d].arr.length;m++){
            for(var n = 0;n<earry[e].arr.length;n++){
              for(var p = 0;p<earry[f].arr.length;p++){
                content = earry[a].arr[i] + ',' + earry[b].arr[k]+ ',' + earry[c].arr[j]+ ',' + earry[d].arr[m]+ ',' + earry[e].arr[n]+ ',' + earry[f].arr[p];
                var odds = (earry[a].odds[i] * earry[b].odds[k] * earry[c].odds[j]* earry[d].odds[m]* earry[e].odds[n]* earry[f].odds[p]).toFixed(2)
                var lotterObj = {
                  playType:playTypes,
                  content:content,
                  odds:odds,
                  payPrice:2,
                  times:1
                }
                lotteryArr.push(lotterObj);
              } 
            }
          }
        }
      }
    }
  }

  if($(this).parent().hasClass('yi')){
    arr1.push(0)
  }else if($(this).parent().hasClass('er')){
    arr1.push(1)
  }else if($(this).parent().hasClass('san')){
    arr1.push(2)
  }else if($(this).parent().hasClass('si')){
    arr1.push(3)
  }else if($(this).parent().hasClass('wu')){
    arr1.push(4)
  }else if($(this).parent().hasClass('liu')){
    arr1.push(5)
  }

  arr2 = arr1.distinct();
  for(var i = 0,iL = arr2.length;i<iL;i++){
    for (var j = i+1;j<iL;j++){
      if(arr2.length == 2){
        
        two(arr2[i],arr2[j]);
      }
      for(var k = j+1;k<iL;k++){
        
        if(arr1.distinct().length == 3){
          three(arr2[i],arr2[j],arr2[k]);
        }
        for(var m = k+1;m<iL;m++ ){
          if(arr1.distinct().length == 4){
            four(arr2[i],arr2[j],arr2[k],arr2[m]);
          }
            for(var n = m+1;n<iL;n++ ){
              if(arr1.distinct().length == 5){
                five(arr2[i],arr2[j],arr2[k],arr2[m],arr2[n]);
              }
              for(var o = n+1;o<iL;o++ ){
                if(arr1.distinct().length == 6){
                  six(arr2[i],arr2[j],arr2[k],arr2[m],arr2[n],arr2[o]);
                }
              }
            }
        }  
      }
    }
  }
  
  $('.content').data('content',lotteryArr)
  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);
})


// 特肖/五行/六肖 一肖（一肖）下注
$('.texiao,.wux,.lxiao,.yxiao').click(function(){
  lotteryArr = [];
  $(this).toggleClass('hover');
  playTypes = $('span',this).data('type');//获取投注方式
  var content = $('span',this).data('content');
  $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
  for(var i = 0,iL =arr1.length;i<iL;i++ ){
    content = arr1[i]
    var lotterObj = {
      playType:playTypes,
      content:content,
      odds:$('i',this).text(),
      payPrice:2,
      times:1
    }
    lotteryArr.push(lotterObj);
    $('.content').data('content',lotteryArr)
  }
  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);
  
})
// 特码头尾/半波/七码 /一肖（尾数）下注
$('.bb span,.qn span,.tmtw span,.qm span,.wsqz span').click(function(){
  lotteryArr = [];
  $(this).toggleClass('hover-v');
  playTypes = $(this).data('type');//获取投注方式
  var content = $(this).data('content');
  $(this).hasClass('hover-v')?arr1.push(content):arr1.pop(content);
  for(var i = 0,iL =arr1.length;i<iL;i++ ){
    content = arr1[i]
    var lotterObj = {
      playType:playTypes,
      content:content,
      odds:$('i',this).text(),
      payPrice:2,
      times:1
    }
    lotteryArr.push(lotterObj);
    $('.content').data('content',lotteryArr)
  }
  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);
  
})
// 生肖连下注
$('.sxiao').click(function(){
  lotteryArr = [];
  playTypes = $('span',this).data('type');//获取投注方式
  if(sxlNav == 'exl' || sxlNav == 'exlbz'){ //二肖连
    var content = $('span',this).data('content');

    if(sxlMav == 'fs'){//复式
      
      $(this).toggleClass('hover');
      $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          content = arr1[i] + ',' + arr1[j]
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:$('i',this).text(),
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
          $('.content').data('content',lotteryArr)
        }
      }
      
    }else if(sxlMav == 'tt'){//拖头
      
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $('span',this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover');
        $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' + arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  } else if(sxlNav == 'sxl' || sxlNav == 'sxlbz'){ //三肖连
    var content = $('span',this).data('content');

    if(sxlMav == 'fs'){//复式
      
      $(this).toggleClass('hover');
      $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            content = arr1[i] + ',' + arr1[j] +','+arr1[k]
            var lotterObj = {
              playType:playTypes,
              content:content,
              odds:$('i',this).text(),
              payPrice:2,
              times:1
            }
            lotteryArr.push(lotterObj);
            $('.content').data('content',lotteryArr)
          }
         
        }
      }
      
    }else if(sxlMav == 'tt'){//拖头
      
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $('span',this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 1){
        $(this).addClass('hover-gray')
        clickCount++;
        tou2 = $('span',this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover');
        $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' +tou2+',' + arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  }else if(sxlNav == 'sixl' || sxlNav == 'sixlbz' ){ //四肖连
    var content = $('span',this).data('content');

    if(sxlMav == 'fs'){//复式
      
      $(this).toggleClass('hover');
      $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]
              var lotterObj = {
                playType:playTypes,
                content:content,
                odds:$('i',this).text(),
                payPrice:2,
                times:1
              }
              lotteryArr.push(lotterObj);
              $('.content').data('content',lotteryArr)
            }
            
          }
         
        }
      }
      
    }else if(sxlMav == 'tt'){//拖头
      
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $('span',this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 1){
        $(this).addClass('hover-gray')
        clickCount++;
        tou2 = $('span',this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 2){
        $(this).addClass('hover-gray')
        clickCount++;
        tou3 = $('span',this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover');
        $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' +tou2+',' + tou3+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  }else if(sxlNav == 'wxl' || sxlNav == 'wxlbz'){ //五肖连
    var content = $('span',this).data('content');

    if(sxlMav == 'fs'){//复式
      
      $(this).toggleClass('hover');
      $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              for(var m = l+1,mL = arr1.length;m<mL;m++){
                content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l] + ','+ arr1[m]
                var lotterObj = {
                  playType:playTypes,
                  content:content,
                  odds:$('i',this).text(),
                  payPrice:2,
                  times:1
                }
                lotteryArr.push(lotterObj);
                $('.content').data('content',lotteryArr)
              }
              
            }
            
          }
         
        }
      }
      
    }else if(sxlMav == 'tt'){//拖头
      
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $('span',this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 1){
        $(this).addClass('hover-gray')
        clickCount++;
        tou2 = $('span',this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 2){
        $(this).addClass('hover-gray')
        clickCount++;
        tou3 = $('span',this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 3){
        $(this).addClass('hover-gray')
        clickCount++;
        tou4 = $('span',this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover');
        $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' +tou2+',' + tou3+','+ ','+tou4+  arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  }
  
  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);
})
// 尾数连下注
$('.wslian span').click(function(){
  lotteryArr = [];
  playTypes = $(this).data('type');//获取投注方式
  if(wslNav == 'ewl' || wslNav == 'ewlbz'){ //二尾连/二尾连不中
    var content = $(this).data('content');

    if(wslMav == 'fs'){//复式
      
      $(this).toggleClass('hover');
      $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          content = arr1[i] + ',' + arr1[j]
          var lotterObj = {
            playType:playTypes,
            content:content,
            odds:$('i',this).text(),
            payPrice:2,
            times:1
          }
          lotteryArr.push(lotterObj);
          $('.content').data('content',lotteryArr)
        }
      }
      
    }else if(wslMav == 'tt'){//拖头
      
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $(this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover');
        $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' + arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  } else if(wslNav == 'swl' || wslNav == 'swlbz'){ //三尾连、三尾连不中
    var content = $(this).data('content');

    if(wslMav == 'fs'){//复式
      
      $(this).toggleClass('hover');
      $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            content = arr1[i] + ',' + arr1[j] +','+arr1[k]
            var lotterObj = {
              playType:playTypes,
              content:content,
              odds:$('i',this).text(),
              payPrice:2,
              times:1
            }
            lotteryArr.push(lotterObj);
            $('.content').data('content',lotteryArr)
          }
         
        }
      }
      
    }else if(wslMav == 'tt'){//拖头
      
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $(this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 1){
        $(this).addClass('hover-gray')
        clickCount++;
        tou2 = $(this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover');
        $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' +tou2+',' + arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  }else if(wslNav == 'siwl' || wslNav == 'siwlbz' ){ //四尾连、四尾连不中
    var content = $(this).data('content');

    if(wslMav == 'fs'){//复式
      
      $(this).toggleClass('hover');
      $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]
              var lotterObj = {
                playType:playTypes,
                content:content,
                odds:$('i',this).text(),
                payPrice:2,
                times:1
              }
              lotteryArr.push(lotterObj);
              $('.content').data('content',lotteryArr)
            }
            
          }
         
        }
      }
      
    }else if(wslMav == 'tt'){//拖头
      
      if(clickCount == 0){
        $(this).addClass('hover-gray')
        clickCount++;
        tou = $(this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 1){
        $(this).addClass('hover-gray')
        clickCount++;
        tou2 = $(this).data('content');
        $(this).data('count','1');
      }else if(clickCount == 2){
        $(this).addClass('hover-gray')
        clickCount++;
        tou3 = $(this).data('content');
        $(this).data('count','1');
      }else{
        $(this).toggleClass('hover');
        $(this).hasClass('hover')?arr1.push(content):arr1.pop(content);
        if($(this).data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = tou + ',' +tou2+',' + tou3+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:$('i',this).text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        $('.content').data('content',lotteryArr)
      }
      
    }
  }
  
  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);
})
// 不中下注
$('.buz span').click(function(){
  var that = $(this)
  rebet(that,bzNav,bzMav);
})
// 多选中一下注
$('.duox span').click(function(){
  var that = $(this);
  rebet(that,zyNav,zyMav);
  
})
// 不中/多选中一 统一方法
function rebet(that,bzNav,bzMav){
  lotteryArr = [];
  playTypes = that.data('type');//获取投注方式
  
  if(bzNav == 'wbz'){ //五不中 、五选中一
    
    var content = that.data('content');
    if(bzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              for(var m = l+1,mL = arr1.length;m<mL;m++){
                content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]+','+arr1[m]
                var lotterObj = {
                  playType:playTypes,
                  content:content,
                  odds:that.find('i').text(),
                  payPrice:2,
                  times:1
                }
                lotteryArr.push(lotterObj);
              }
            } 
          }
        }
      }
      
    }else if(bzMav == 'tt'){//拖头

      if(clickCount <= 3){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push($(this).data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }
      
    }
  }else if(bzNav == 'lbz'){ //六不中、六选中一
    
    var content = that.data('content');
    if(bzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              for(var m = l+1,mL = arr1.length;m<mL;m++){
                for(var n = m+1,nL = arr1.length;n<nL;n++){
                  content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]+','+arr1[m]+','+arr1[n]
                  var lotterObj = {
                    playType:playTypes,
                    content:content,
                    odds:that.find('i').text(),
                    payPrice:2,
                    times:1
                  }
                  lotteryArr.push(lotterObj);
                }
              }
            } 
          }
        }
      }

      
    }else if(bzMav == 'tt'){//拖头

      if(clickCount <= 4){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }
      
    }
  }else if(bzNav == 'qbz'){ //七不中、七选中一
    
    var content = that.data('content');
    if(bzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              for(var m = l+1,mL = arr1.length;m<mL;m++){
                for(var n = m+1,nL = arr1.length;n<nL;n++){
                  for(var o = n+1,oL = arr1.length;o<oL;o++){
                    content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]+','+arr1[m]+','+arr1[n]+','+arr1[0]
                    var lotterObj = {
                      playType:playTypes,
                      content:content,
                      odds:that.find('i').text(),
                      payPrice:2,
                      times:1
                    }
                    lotteryArr.push(lotterObj);
                  }
                  
                }
              }
            } 
          }
        }
      }
      
    }else if(bzMav == 'tt'){//拖头

      if(clickCount <= 5){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        $(this).data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }
      
    }
  }else if(bzNav == 'bbz'){ //八不中、八选中一
    
    var content = that.data('content');
    if(bzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              for(var m = l+1,mL = arr1.length;m<mL;m++){
                for(var n = m+1,nL = arr1.length;n<nL;n++){
                  for(var o = n+1,oL = arr1.length;o<oL;o++){
                    for(var p = o+1,pL = arr1.length;p<pL;p++){
                      content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]+','+arr1[m]+','+arr1[n]+','+arr1[o]+','+arr1[p]
                      var lotterObj = {
                        playType:playTypes,
                        content:content,
                        odds:that.find('i').text(),
                        payPrice:2,
                        times:1
                      }
                      lotteryArr.push(lotterObj);
                    }
                    
                  }
                  
                }
              }
            } 
          }
        }
      }
      
    }else if(bzMav == 'tt'){//拖头

      if(clickCount <= 6){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }
      
    }
  }else if(bzNav == 'jbz'){ //九不中、九选中一
    
    var content = that.data('content');
    if(bzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              for(var m = l+1,mL = arr1.length;m<mL;m++){
                for(var n = m+1,nL = arr1.length;n<nL;n++){
                  for(var o = n+1,oL = arr1.length;o<oL;o++){
                    for(var p = o+1,pL = arr1.length;p<pL;p++){
                      for(var q = p+1,qL = arr1.length;q<qL;q++){
                        content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]+','+arr1[m]+','+arr1[n]+','+arr1[o]+','+arr1[p]+','+arr1[q]
                        var lotterObj = {
                          playType:playTypes,
                          content:content,
                          odds:that.find('i').text(),
                          payPrice:2,
                          times:1
                        }
                        lotteryArr.push(lotterObj);
                      }
                      
                    }
                    
                  }
                  
                }
              }
            } 
          }
        }
      }
      
    }else if(bzMav == 'tt'){//拖头

      if(clickCount <= 7){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }
      
    }
  }else if(bzNav == 'sbz'){ //十不中、十选中一
    
    var content = that.data('content');
    if(bzMav == 'fs'){//复式
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        for(var j = i+1,jL = arr1.length;j<jL;j++){
          for(var k = j+1,kL = arr1.length;k<kL;k++){
            for(var l = k+1,lL = arr1.length;l<lL;l++){
              for(var m = l+1,mL = arr1.length;m<mL;m++){
                for(var n = m+1,nL = arr1.length;n<nL;n++){
                  for(var o = n+1,oL = arr1.length;o<oL;o++){
                    for(var p = o+1,pL = arr1.length;p<pL;p++){
                      for(var q = p+1,qL = arr1.length;q<qL;q++){
                        for(var r = q+1,rL = arr1.length;r<rL;r++){
                          content = arr1[i] + ',' + arr1[j] +','+arr1[k] + ','+arr1[l]+','+arr1[m]+','+arr1[n]+','+arr1[o]+','+arr1[p]+','+arr1[q]+','+arr1[r]
                          var lotterObj = {
                            playType:playTypes,
                            content:content,
                            odds:that.find('i').text(),
                            payPrice:2,
                            times:1
                          }
                          lotteryArr.push(lotterObj);
                        }
                        
                      }
                      
                    }
                    
                  }
                  
                }
              }
            } 
          }
        }
      }
      
    }else if(bzMav == 'tt'){//拖头

      if(clickCount <= 8){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }
      
    }
  }
  
  $('.content').data('content',lotteryArr);
  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);
}

// 特平中下注
$('.tep span').click(function(){
  var that = $(this);
  lotteryArr = [];
  playTypes = that.data('type');//获取投注方式
  
  if(tpzNav == 'ylrz'){//一粒任中
    var content = that.data('content');
    that.toggleClass('hover');
    that.hasClass('hover')?arr1.push(content):arr1.pop(content);

    for(var i = 0,iL = arr1.length;i<iL;i++){
      content = arr1[i];
      var lotterObj = {
        playType:playTypes,
        content:content,
        odds:that.find('i').text(),
        payPrice:2,
        times:1
      }
      lotteryArr.push(lotterObj);
    }
    
  }else if(tpzNav == 'elrz'){//二粒任中
    var content = that.data('content');
    
    if(tpzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);

      for(var i = 0,iL = arr1.length;i<iL;i++){
        for(var j = i+1;j<iL;j++){
          content = arr1[i] + ',' + arr1[j];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
        }
        
      }
    }else{ //拖头

      if(clickCount < 1){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }

    }
  }else if(tpzNav == 'slrz'){//三粒任中
    var content = that.data('content');
    
    if(tpzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);

      for(var i = 0,iL = arr1.length;i<iL;i++){
        for(var j = i+1;j<iL;j++){
          for(var k = j+1;k<iL;k++){
            content = arr1[i] + ',' + arr1[j]+ ',' + arr1[k];
            var lotterObj = {
              playType:playTypes,
              content:content,
              odds:that.find('i').text(),
              payPrice:2,
              times:1
            }
            lotteryArr.push(lotterObj);
          }
        }
      }
    }else{ //拖头

      if(clickCount < 2){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }

    }
  }else if(tpzNav == 'silrz'){//四粒任中
    var content = that.data('content');
    
    if(tpzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);

      for(var i = 0,iL = arr1.length;i<iL;i++){
        for(var j = i+1;j<iL;j++){
          for(var k = j+1;k<iL;k++){
            for(var l = k+1;l<iL;l++){
              content = arr1[i] + ',' + arr1[j]+ ',' + arr1[k]+ ',' + arr1[l];
              var lotterObj = {
                playType:playTypes,
                content:content,
                odds:that.find('i').text(),
                payPrice:2,
                times:1
              }
              lotteryArr.push(lotterObj);
            }
            
          }
        }
      }
    }else{ //拖头

      if(clickCount < 3){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }

    }
  }else if(tpzNav == 'wlrz'){//五粒任中
    var content = that.data('content');
    
    if(tpzMav == 'fs'){//复式
      
      that.toggleClass('hover');
      that.hasClass('hover')?arr1.push(content):arr1.pop(content);

      for(var i = 0,iL = arr1.length;i<iL;i++){
        for(var j = i+1;j<iL;j++){
          for(var k = j+1;k<iL;k++){
            for(var l = k+1;l<iL;l++){
              for(var m = l+1;m<iL;m++){
                content = arr1[i] + ',' + arr1[j]+ ',' + arr1[k]+ ',' + arr1[l]+ ',' + arr1[m];
                var lotterObj = {
                  playType:playTypes,
                  content:content,
                  odds:that.find('i').text(),
                  payPrice:2,
                  times:1
                }
                lotteryArr.push(lotterObj);
              }
              
            }
            
          }
        }
      }
    }else{ //拖头

      if(clickCount < 4){
        that.addClass('hover-gray');
        clickCount++;
        arr2.push(that.data('content'));
        that.data('count','1');
      }else{
        that.toggleClass('hover');
        that.hasClass('hover')?arr1.push(content):arr1.pop(content);
        if(that.data('count') == '1'){
          reset()
        }
      }
      for(var i = 0,iL=arr1.length;i<iL;i++){
        content = arr2.join(',')+','+ arr1[i];
        var lotterObj = {
          playType:playTypes,
          content:content,
          odds:that.find('i').text(),
          payPrice:2,
          times:1
        }
        lotteryArr.push(lotterObj);
      }

    }
  }

  $('.content').data('content',lotteryArr);
  $('#zhu').text(lotteryArr.length);
  $('#money').text(lotteryArr.length * 2);
})



// 获取生肖对应数字
function sxNumber(){
  var obj = jsonObj;
  $ajax(
    url+'sx_number',
    'post',
    obj,
    function(data){
      
      var arry = data.data.sxNumber;
      for(var i = 0,iL=arry.length;i<iL;i++){
        $('.sxdp span').eq(i).data('index',arry[i]);
        $('.sxdp2 span').eq(i).data('index',arry[i]);
        $('.swdp span').eq(i).data('index',arry[i]);
      }
      
    },
    function(data){
      layer.msg(data.msg);
    }
  )
}


// 点击重置
$('.reset').click(function(){
  reset()
})
// 重置
function reset(){
  number = 0;
  money = 0;
  $('#zhu').text(0);
  $('#money').text(0);
  $('.bifa-m span').removeClass('hover');
  $('.bifa-m span').removeClass('hover-v');
  $('.bifa-m span').removeClass('hover-gray');
  $('.sxiao').removeClass('hover-gray');
  $('.texiao,.wux,.lxiao,.yxiao,.sxiao').removeClass('hover')
  lotteryArr = [];
  arr1 = [];
  arr2 = [];
  clickCount = 0;
  earry = [{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]}]; //过关下注存储数组
}
// 下注
var buyObj = jsonObj;
var uid = getCookie('uid');
$('.action').click(function(){

  if(lotteryArr.length>0){
    
    layer.open({
      type: 2,
      area: ['600px', '400px'],
      fixed: false, //不固定
      maxmin: true,
      content: './action.html',
      end:function(){
        lotteryArr = [];
        earry = [{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]},{arr:[],odds:[]}]; //过关下注存储数组
        arr1 = [],arr2=[];
        number = 0;
        money = 0;
        $('#zhu').text(0);
        $('#money').text(0);
        $('.bifa-m span').removeClass('hover-v');
        $('.bifa-m span').removeClass('hover-gray');
        $('.texiao,.wux,.lxiao,.yxiao,.sxiao').removeClass('hover');
        $('.sxiao').removeClass('hover-gray');
      }
    });
    
  }else{
    layer.msg('请选择你要投注的内容');
  }
  
})
// 历史走势
$('#tendency').click(function(){
  layer.open({
    type: 2,
    area: ['600px', '400px'],
    fixed: false, //不固定
    maxmin: true,
    content: './trend.html'
  })
})
// 视频
$('#video').click(function(){
  layer.msg('敬请期待');
})

// 特码赔率
function tms(tm){
  $('.tma-number span i').text(tm.pl);
  $('.tma-fk span.tm-dxds i').text(tm.dxds);
  $('.tma-fk span.tm-hds i').text(tm.hds);
  $('.tma-fk span.tm-w i').text(tm.wdx);
  $('.tma-fk span.tm-hb i').text(tm.hb);
  $('.tma-fk span.tm-lanb i').text(tm.lanb);
  $('.tma-fk span.tm-lb i').text(tm.lb);
}
// 正码赔率
function zms(zm){
  $('.zma-number span i').text(zm.pl);
  $('.zma-fk span i').text(zm.zdxds);
}
// 正特码赔率
function ztms(ztm){
  $('.ztma-number span i').text(ztm.pl);
  $('.ztma-fk span.ztm-dx i').text(ztm.dxds);
  $('.ztma-fk span.ztm-ds i').text(ztm.dxds);
  $('.ztma-fk span.ztm-hds i').text(ztm.hds);
  $('.ztma-fk span.ztm-wdx i').text(ztm.wdx);
  $('.ztma-fk span.ztm-hb i').text(ztm.hb);
  $('.ztma-fk span.ztm-lanb i').text(ztm.lanb);
  $('.ztma-fk span.ztm-lb i').text(ztm.lb);
}
// 连码赔率
function lms(lm){
  $('.lma-list .bifa-m span i').text(lm.eqz)
}
// 过关赔率
function ggs(gg){
  $('.gg span.gg-dsdx i').text(gg.dxds);
  $('.gg span.gg-hb i').text(gg.hb);
  $('.gg span.gg-lanb i').text(gg.lanb);
  $('.gg span.gg-lb i').text(gg.lb);
}
// 特肖赔率
function txs(tx){
  $('.texiao i').text(tx.other);
  $('.texiao i.gou').text(tx.gou)
}
// 特码头尾赔率
function tmtws(tmtw){
  $('.tmt span i').text(tmtw.tmt.yds)
  $('.tmt span.ling i').text(tmtw.tmt.ling)
  $('.tmw span i').text(tmtw.tmw.ydjw)
  $('.tmw span.ling i').text(tmtw.tmw.ling)
}
// 五行赔率
function wxs(wx){
  $('.wux i').text(wx.jmsh);
  $('.wux i.tu').text(wx.tu)
}
// 半波赔率
function bbs(bb){
  $('.bb span.hdan i').text(bb.hd);
  $('.bb span.hs i').text(bb.hs);
  $('.bb span.hda i').text(bb.hda);
  $('.bb span.hx i').text(bb.hx);

  $('.bb span.ld i').text(bb.ld);
  $('.bb span.ls i').text(bb.ls);
  $('.bb span.lda i').text(bb.lda);
  $('.bb span.lx i').text(bb.lx);

  $('.bb span.lvd i').text(bb.lvd);
  $('.bb span.lvs i').text(bb.lvs);
  $('.bb span.lvda i').text(bb.lvda);
  $('.bb span.lvx i').text(bb.lvx);
}
// 七码赔率
function qms(qm){

  var len = $('.qmd span i').length;
  for(var i = 0;i<len;i++){
    $('.qmd span i').eq(i).text(qm['dan'+i]);
    $('.qms span i').eq(i).text(qm['shuang'+i]);
    $('.qmda span i').eq(i).text(qm['da'+i]);
    $('.qmx span i').eq(i).text(qm['xiao'+i]);
  }
}
// 六肖赔率
function lxs(lx){
  $('.lxiao i').text(lx.ex)
}
// 一肖尾数赔率
function yxwss(yxws){
  $('.yxiao i').text(yxws.yxother)
  $('.yxiao i.gou').text(yxws.yxgou)
  
  $('.wsqz span i').text(yxws.wsydj)
  $('.wsqz span.ling i').text(yxws.ws0)
}
// 生肖连赔率
function sxls(sxl){
  $('.sxiao i').text(sxl.exlzother);
  $('.sxiao i.gou').text(sxl.exlzgou);
}
// 尾数连赔率
function wsls(wsl){
  $('.wslian span i').text(wsl.ewlz);
}
// 不中赔率
function bzs(bz){
  $('.buz span i').text(bz.wbz)
};
// 多选中一赔率
function dxzys(dxzy){
  $('.duox span i').text(dxzy.wxzy)
};
// 特平中赔率
function tpzs(tpz){
  $('.tep span i').text(tpz.ylrz)
};

// 初始化数据
function init (type){
  var obj = jsonObj;
  obj.type = type;//六合彩

  $ajax(
    url+'dead_awar',
    'post',
    obj,
    function(data){
      
      var countDown = data.data.countDown;//彩票信息

      $('#lotteryName').text(countDown.lotteryName);//中文名称
      $('#lotteryName').data('type',countDown.LotteryType);//存储彩种类型
  
      $('#issue').text(countDown.issue);
      if(countDown.status == -1){
        $('#status').text('已关盘')
      }else if(countDown.status == 0){
        $('#status').text('已封盘')
        $('.alert-sec-circle').css('border','5px solid red');
        
        
      }else if(countDown.status == 1){
        $('#status').text('离封盘')
        // 赔率
        var oddsData = data.data.oddsData;
        // 特码
        tms(oddsData.tm);
        // 正码
        zms(oddsData.zm);
        // 正特码
        ztms(oddsData.ztm);
        // 连码
        lms(oddsData.lm);
        $('.lma-content').data('odds',oddsData.lm);
        // 过关
        ggs(oddsData.gg);
        // 特肖
        txs(oddsData.tx);
        // 特码头尾
        tmtws(oddsData.tmtw);
        // 五行
        wxs(oddsData.wx);
        // 半波
        bbs(oddsData.bb);
        // 七码
        qms(oddsData.qm);
        // 六肖
        lxs(oddsData.lx)
        $('.liux').data('odds',oddsData.lx);
        // 一肖尾数
        yxwss(oddsData.yxws);
        $('.yix').data('odds',oddsData.yxws);
        // 生肖连
        sxls(oddsData.sxl);
        $('.sxiaol').data('odds',oddsData.sxl);
        // 尾数连
        wsls(oddsData.wsl);
        $('.wshul').data('odds',oddsData.wsl);
        // 不中
        bzs(oddsData.bz);
        $('.buzhong').data('odds',oddsData.bz);
        // 多选中一
        dxzys(oddsData.dxzy);
        $('.duoxuan').data('odds',oddsData.dxzy);
        // 特平中
        tpzs(oddsData.tpz);
        $('.teping').data('odds',oddsData.tpz);
      }

      resetTime(countDown.countDown,$('#deadline'))//封盘倒计时

      var openResult = data.data.openResult;//上期开奖
      
      $('#prevGameNo').text(openResult.issue);
      var numberArry = openResult.haoma;//开奖号码
      
      var res = '';
      for(var i = 0,iL = numberArry.length-1;i<iL;i++){
        if(numberArry[i].color == 'R'){
          res += '<span class="numbers red">'+numberArry[i].number+'</span>'
        }else if(numberArry[i].color == 'G'){
          res += '<span class="numbers green">'+numberArry[i].number+'</span>'
        }else if(numberArry[i].color == 'B'){
          res += '<span class="numbers blue">'+numberArry[i].number+'</span>'
        }
      }
      if(numberArry[i].color == 'R'){
        res += '+ ' + '<span class="numbers red">'+numberArry[numberArry.length-1].number+'</span>'
      }else if(numberArry[i].color == 'G'){
        res += '+ ' + '<span class="numbers green">'+numberArry[numberArry.length-1].number+'</span>'
      }else if(numberArry[i].color == 'B'){
        res += '+ ' +  '<span class="numbers blue">'+numberArry[numberArry.length-1].number+'</span>'
      }

      $('#draw').html(res)

      
    },
    function(data){
      
      layer.msg(data.msg);
    }
  )

  // 开奖结果
  obj.rows = 10;
  obj.page = 1;
  $ajax(
    url+'lott_list',
    'post',
    obj,
    function(data){
      
      var list = data.data;
      
      var numberArr = list[1].number.split(',');
      
      var res = '';
      for(var i = 0,iL = list.length;i<iL;i++){

        res += '<ul class="ssc double_bg">'+
                  '<li>'+
                    '<div class="qi">'+
                      ''+list[i].issue.slice(-3)+'<font class="qiZiColor">期</font>'+
                    '</div>';
        if(list[i].number !== null){

          for(var j = 0,jL=numberArr.length;j<jL;j++){
            res+='<div class="num">'+list[i].number.split(',')[j]+'</div>'
                
          }
        }
        
        res += '</li>'+
              '</ul>'
            
      }
      $('#results').html(res)
    },
    function(data){
      layer.msg(data.msg);
    }
  )
  // 公告
  var uid = getCookie('uid');
  obj.count = 5;
  obj.uid = uid;

  $ajax(
    url+'message',
    'post',
    obj,
    function(data){
      
      var messageArr = data.data
      
      var mess = '';
      for(var i = 0,iL=messageArr.length;i<iL;i++){
        mess+='<li >'+
            '<a href="'+messageArr[i].url+'" class="a">'+messageArr[i].title+'</a>'+
            '<span class="date">'+messageArr[i].pubdate.split(' ')[0]+'</span>'+
          '</li>'
      }
      $('#notice').html(mess)
    },
    function(data){
      clearCookie('uid');
      layer.msg(data.msg);
    }
  )
}

